﻿namespace MSRI.ActiveSyncServices
{
    using System;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;

    [Guid("C6659361-1625-4746-931C-36014B146679")]
    public class DccManSink : IDccManSink
    {
        public event ActiveHandler Active;

        public event OnLogIpAddrHandler ConnectedToIPaddress;

        public event DisconnectHandler Disconnect;

        public int OnLogActive()
        {
            if (this.Active != null)
            {
                this.Active();
            }
            return 0;
        }

        public int OnLogAnswered()
        {
            return 0;
        }

        public int OnLogDisconnection()
        {
            if (this.Disconnect != null)
            {
                this.Disconnect();
            }
            return 0;
        }

        public int OnLogError()
        {
            return 0;
        }

        public int OnLogInactive()
        {
            return 0;
        }

        public int OnLogIpAddr(int dwIpAddr)
        {
            if (this.ConnectedToIPaddress != null)
            {
                this.ConnectedToIPaddress(dwIpAddr);
            }
            return 0;
        }

        public int OnLogListen()
        {
            return 0;
        }

        public int OnLogTerminated()
        {
            return 0;
        }

        [Serializable, ComVisible(true)]
        public delegate void ActiveHandler();

        [Serializable, ComVisible(true)]
        public delegate void DisconnectHandler();

        [Serializable, ComVisible(true)]
        public delegate void OnLogIpAddrHandler(int dwIpAddr);
    }
}

